#include "chap12.h"
#include <stdio.h>
#include <pthread.h>

extern int beers;
extern pthread_mutex_t beers_lock;

void* drink_lots(void* a) {
	int i;
	for (i = 0; i < 100000; i++) {
		pthread_mutex_lock(&beers_lock);
		beers -= 1;
		pthread_mutex_unlock(&beers_lock);
	}
	printf("beers = %d\n", beers);
	return NULL;
}

